﻿package plugin.accomplishment
{
    import com.core.*;
    import flash.events.*;
    import manager.*;
    import morn.core.components.*;
    import uiresource.Accomplishment.*;

    public class ItemCtrl extends ItemCtrlUI
    {
        private var _obj:Object;
        private var openLevel:Object;

        public function ItemCtrl()
        {
            this.openLevel = ConfigDictionary.data.openlevel;
            return;
        }// end function

        override protected function initializeView() : void
        {
            return;
        }// end function

        protected function openPlugin(event:Event) : void
        {
            var _loc_2:int = 0;
            if (this.obj.plugins)
            {
                _loc_2 = UserData.getUserData("level");
                if (this.openLevel[this.obj.plugins])
                {
                    if (_loc_2 >= int(this.openLevel[this.obj.plugins][0].level))
                    {
                        ModelProxy.change("plugin", "open", {target:this.obj.plugins});
                    }
                    else
                    {
                        WarningManager.show(30, [this.openLevel[this.obj.plugins][0].level, this.obj.pluginsName]);
                    }
                }
            }
            return;
        }// end function

        public function set obj(param1:Object) : void
        {
            var _loc_2:Label = null;
            this._obj = param1;
            if (this._obj)
            {
                _loc_2 = this.getChildByName("txt_describe") as Label;
                if (_loc_2)
                {
                    _loc_2.addEventListener(MouseEvent.CLICK, this.openPlugin);
                }
            }
            return;
        }// end function

        public function get obj() : Object
        {
            return this._obj;
        }// end function

    }
}
